package org.wdcode.web.memcache.client;

import org.wdcode.core.factory.BaseKeyFactory;
import org.wdcode.web.memcache.need.BaseMemCacheNeed;
import org.wdcode.web.memcache.need.MemCacheNeed;

/**
 * MemCached的客户端调用工厂
 * @author WD
 * @since JDK6
 * @version 1.0 2010-08-29
 */
public final class MemCacheClientFactory extends BaseKeyFactory<MemCacheNeed, MemCacheClient> {
	// 工厂
	private final static MemCacheClientFactory	FACTORY;
	/**
	 * 静态初始化
	 */
	static {
		FACTORY = new MemCacheClientFactory();
	}

	/**
	 * 私有构造
	 */
	private MemCacheClientFactory() {}

	/**
	 * 获得工厂
	 * @return MemCacheClientFactory
	 */
	public final static MemCacheClientFactory getFactory() {
		return FACTORY;
	}

	/**
	 * 实例化一个新对象
	 * @return MemCacheClient
	 */
	public final MemCacheClient newInstance() {
		return newInstance(new BaseMemCacheNeed());
	}

	/**
	 * 实例一个新的索引写入器
	 * @param need 构建Lucene所用类
	 * @return MemCacheClient
	 */
	public final MemCacheClient newInstance(MemCacheNeed need) {
		return new MemCacheClientImpl(need);
	}
}
